<?php

class Categoria{
	
	public $bd;
	public $resultado;
	
	public function __construct(){
		
		$this->bd = new Basedatos();
		
	}
	
	public function mostrar_categoria(){
		
		$query = "CALL MostrarCategoria()";
		$this->result = $this->bd->select($query);
		return $this->result;
	}
	public function nombre_icono($id){
		
		$query = "CALL MostrarIconoCategoria('".$id."')";
		$this->result = $this->bd->select($query);
		return $this->result;		
		
	}
	public function mostrar_icono(){
		
		$query = "CALL MostrarIcono()";
		$this->result = $this->bd->select($query);
		return $this->result;	
	}
	public function agregar_categoria($id,$nombre,$descr,$ico){
		
		$query = "CALL AgregarCategoria('".$id."','".$nombre."','".$descr."','".$ico."')";
		$this->result = $this->bd->insert($query);
		
	}
	public function mostrar_una_categoria($id){
		$query = "SELECT * FROM categoria WHERE id_categoria = '$id'";
		$this->result = $this->bd->select($query);
		return $this->result;
	}
	public function mostrar_producto_categoria($id){
		$query = "SELECT * FROM producto WHERE id_categoria = '$id'";
		$this->result = $this->bd->select($query);
		return $this->result;
	}
}
?>